package com.aloha.auth.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;

/**
 * @author zhdai
 * @date 2023/11/9 21:55
 */
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(AuthException.class)
    public Object handler(AuthException e) {
        return new HashMap<String, Object>() {{
            put("code", e.getCode());
            put("msg", e.getMsg());
        }};
    }
}
